<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/6/28 17:07
 * Modified Time: 2019/6/28 17:07
 * Version: 2.0
 */

namespace App\Modules\Store\Repositories;


use App\Models\StoreRenewal;
use App\Modules\Activity\Validators\ActivityValidators;
use Flower\Core\Repository\Eloquent\BaseRepository;

class StoreRenewalRepository extends BaseRepository
{
    public function model()
    {
        return StoreRenewal::class;
    }

    public function createStoreRenewal($user_id,$renewal_id,$years,$price,$status,$renewal_no)
    {
        $data = [
            'user_id' => $user_id,
            'renewal_id' => $renewal_id?$renewal_id:1,
            'years' => $years,
            'status' => $status,
            'price' => $price,
            'renewal_no' => $renewal_no,
        ];

        return $this->create($data);
    }

    public function getStoreRenewalByNo($no){
        return $this->findByField(['renewal_no'=>$no])->first();
    }

}